package com.ziroom.crm.rock.spring.init;

import com.ziroom.crm.mq.core.Env;
import com.ziroom.crm.rock.spring.util.SpringContextUtils;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;

/**
 * <p></p>
 * <p>
 * <PRE>
 * <BR>    修改记录
 * <BR>-----------------------------------------------
 * <BR>    修改日期         修改人          修改内容
 * </PRE>
 *
 * @author WeiShaoying
 * @version 1.0
 * @date Created in 2020年09月07日 15:59
 * @since 1.0
 */
public class ReliableMqInit implements ApplicationListener<ContextRefreshedEvent>, ApplicationContextAware {


    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        // spring boot初始化成功
        Env.init();
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        SpringContextUtils.setApplicationContext(applicationContext);
    }
}
